<?php
namespace app\common\validate;
use think\Validate;
/**
 * 用户验证器
 * @author laizhiyong <1029460965@qq.com>
 */
class User extends Validate
{
    protected $rule = [


    ];
    protected $message = [

    ];

    /**
     * 定义验证场景
     */
    protected $scene = [

    ];

    /**
     * @param $value
     * @return bool|string
     */
    protected function checkTel($value){
        if (!preg_match("/^1[34578]\d{9}$/", $value)){
            return '手机格式错误';
        }
        return true;
    }

    /**
     * @param $value
     * @return bool|string
     */
    protected function checkIdCard($value){
        if (!preg_match('/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$/', $value)){
            return '身份证号格式错误';
        }
        return true;
    }



}
